package com.example.adminframework.model.bo;

//import com.xiangfu.framework.common.util.JsonUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

/**
 * 条件
 */
@ApiModel("条件")
public class FilterBO {
    /**
     * 字段
     */
    @ApiModelProperty("字段")
    private String field;
    /**
     * 比较符
     */
    @ApiModelProperty("比较符。支持{=,!=,<,<=,>,>=,like,in,not_in,start_with,end_with,is_null,not_null,between,concatLike}")
    private String operator;
    /**
     * 比较值
     */
    @ApiModelProperty("比较值")
    private Object value;

    public FilterBO() {
    }

    public FilterBO(String field, String operator, Object value) {
        this.field = field;
        this.operator = operator;
        this.value = value;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
//        this.field = SqlUtil.humpToLine(field);
        this.field = field;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public Object getValue() {
        return value;
    }

//    public void setValue(Object value) {
//
//        if(value instanceof Number||value instanceof List||value instanceof String){
//            this.value=value;
//        }else {
//            ValueVO valueVO = JsonUtil.obj2tClass(value, ValueVO.class);
//            this.value = valueVO.toList();
//        }
//    }

    @Override
    public String toString() {
        return "Filter{" +
                "field='" + field + '\'' +
                ", operator='" + operator + '\'' +
                ", value=" + value +
                '}';
    }
}
